﻿using System;
using System.Collections.Generic;
using System.Text;
using X.Entity;
using System.Reflection;

namespace X.DataFactory
{
    public interface INews
    {
        bool Create(NewsInfo newsInfo);
        bool Delete(int newsId);
        bool Update(NewsInfo newsInfo);
        IList<NewsInfo> GetList(int topCount);
        IList<NewsInfo> GetAllList();
        NewsInfo GetNewsInfo(int newId);
        NewsInfo GetNewsInfo(string title);
    }

    public sealed partial class DataAccess
    {
        public static INews CreateNews()
        {
            string typeName = path + ".News";

            return (INews)Assembly.Load(path).CreateInstance(typeName);
        }
    }
}
